package com.cjack.frenchexcel.dao;

import com.cjack.frenchexcel.table.CloudDiskTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface CloudDiskDao extends JpaRepository<CloudDiskTable, Long>, JpaSpecificationExecutor<CloudDiskTable> {
    List<CloudDiskTable> findByOtherIdIsNull();
    List<CloudDiskTable> findByContentType( Integer contentType);
    List<CloudDiskTable> findByOtherId( Long otherId);
    int countByCloudDiskNoProfix( String cloudDiskNoProfix);

    @Transactional( timeout = 100)
    @Modifying
    @Query( value = "update fe_clouddisk set other_id=null where id=?1", nativeQuery = true)
    int updateFiledById(Long id);
}
